package net.togogo.controller;

import net.togogo.bean.User;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;


//@RestController  @@ResponseBody与@Controller组合注解
@RestController
public class UserController {

    @RequestMapping("/hello")
    public User sayHello(){
        User user = new User(1,"钱多多","java","男");
        return user;
    }

    @RequestMapping("/hi")
    public List<User> listUsers(){
        User user1 = new User(1,"钱多多","java","男");
        User user2 = new User(2,"钱多","HTML","男");
        User user3 = new User(3,"钱","Oracle","男");
        List<User> userList = new ArrayList<>();
        userList.add(user1);
        userList.add(user2);
        userList.add(user3);
        return userList;
    }
}
